﻿<Window x:Class="Onvif_IP_Camera_Manager.View.CameraServer"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:converter="clr-namespace:Onvif_IP_Camera_Manager.View.Converters"
        Icon="/Onvif IP Camera Manager;component/Resources/ip_camera_sdk_icon_transparent_128x128.png"
        DataContext="{Binding RelativeSource={RelativeSource Self}}"
        Title="CameraServer" Height="500" Width="300" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize">
    <Window.Resources>
       <converter:CameraClientConverter x:Key="CameraClientConverter"/>
    </Window.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="2*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="5*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="2*"/>
            </Grid.ColumnDefinitions>
            <Label Grid.Column="0" Content="Camera Server"/>
            <Grid Grid.Column="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Button Click="StartButton" Grid.Column="0" Content="Start" Height="25" Width="70"/>
                <Button Click="StopButton" Grid.Column="1" Content="Stop" Height="25" Width="70" />
            </Grid>
        </Grid>

        <Grid Grid.Row="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="2*"/>
            </Grid.ColumnDefinitions>
            <Label Grid.Column="0" Content="State"/>
            <Label Grid.Column="1" FontWeight="Bold" Content="{Binding Server.State}" HorizontalAlignment="Center" />
        </Grid>

        <GroupBox Header="Set Listen Address" Grid.Row="0">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid Grid.Row="0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="3*"/>
                    </Grid.ColumnDefinitions>
                    <Label Grid.Column="0" Content="Address"/>
                    <TextBox Grid.Column="1" Height="25" Text="{Binding Server.IpAddress}"/>
                </Grid>
                <Grid Grid.Row="1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="3*"/>
                    </Grid.ColumnDefinitions>
                    <Label Grid.Column="0" Content="Port"/>
                    <TextBox Grid.Column="1" Height="25" Text="{Binding Server.Port}"/>
                </Grid>
            </Grid>
        </GroupBox>
        
        <GroupBox Header="Connected clients" Grid.Row="3">
            <ListBox ItemsSource="{Binding Server.ConnectedClients, Converter={StaticResource CameraClientConverter}}" />
        </GroupBox>
        
        <Button IsCancel="True" Click="CancelButton" Grid.Row="4" Height="25" Width="70" HorizontalAlignment="Right" VerticalAlignment="Center" Content="Cancel"/>
        
    </Grid>
</Window>
